Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] delete file #1122

Merged
merged 23 commits into from
Dec 10, 2024
Merged

[api] delete file #1122

merged 23 commits into from
Dec 10, 2024

Conversation

MalinAhlberg
Copy link
Contributor

@MalinAhlberg MalinAhlberg commented Nov 7, 2024

Related issue(s) and PR(s)
This PR closes #1134 .

Description
This PR adds the delete file functionality to the api component. Specifically, it deletes the file from the inbox and it adds a new file log event, setting the file status to disabled.

Also, it adds the fileID to the list functionality of the api, since that field is needed in order to delete a file:

curl -H "Authorization: Bearer $token" "http://localhost:8090/users/[email protected]/files" | jq .
[
  {
    "fileID": "d32f7117-bb85-40e2-9c52-101bf9c1ca5a",
    "inboxPath": "test_dummy.org/race_file.c4gh",
    "fileStatus": "ready",
    "createAt": "2024-11-19T10:50:07.836513Z"
  },
  {...

How to test
make build-all then PR_NUMBER=$(date +%F) docker compose -f .github/integration/sda-s3-integration.yml run integration_test.
List the files (eg with http://localhost:8090/users/[email protected]/files) and make sure files in the inbox can be deleted, and that archived files can not be deleted.

@MalinAhlberg MalinAhlberg force-pushed the feature/api-delete-file branch 8 times, most recently from b31bc38 to 446a1ff Compare November 21, 2024 10:22
@MalinAhlberg MalinAhlberg marked this pull request as ready for review November 21, 2024 10:22
@MalinAhlberg MalinAhlberg requested a review from a team November 21, 2024 10:25
Copy link
Contributor

@kostas-kou kostas-kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job. I have only some minor comments

sda/cmd/api/api.go Outdated Show resolved Hide resolved
sda/internal/database/database.go Show resolved Hide resolved
.github/integration/tests/sda/60_api_admin_test.sh Outdated Show resolved Hide resolved
sda/cmd/api/api.md Show resolved Hide resolved
@MalinAhlberg
Copy link
Contributor Author

MalinAhlberg commented Nov 27, 2024

Great comments @kostas-kou ! Fixed most of them in 92903a6, but left this one for others to see <- solved during stand-up.

kostas-kou
kostas-kou previously approved these changes Nov 28, 2024
pahatz
pahatz previously approved these changes Nov 28, 2024
Copy link
Contributor

@pahatz pahatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Especially on the tests, very extensive.
I don't have any significant remark on the PR.

sda/cmd/api/api.go Outdated Show resolved Hide resolved
sda/internal/database/db_functions.go Show resolved Hide resolved
@MalinAhlberg MalinAhlberg dismissed stale reviews from pahatz and kostas-kou via 353261a November 29, 2024 07:52
@MalinAhlberg MalinAhlberg force-pushed the feature/api-delete-file branch from 353261a to 3ac7e5e Compare November 29, 2024 08:51
@MalinAhlberg
Copy link
Contributor Author

@kostas-kou and @pahatz, thanks for your reviews! I have fixed the weird comment, rebased on main and also rebased to get rid of the fixup-commits. Only 3ac7e5e is new, the rest is the same as when you reviewed.

@MalinAhlberg
Copy link
Contributor Author

...and added 8a745c4 for the rbac

pahatz
pahatz previously approved these changes Nov 29, 2024
aaperis
aaperis previously approved these changes Dec 2, 2024
Copy link
Contributor

@aaperis aaperis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested, but it looks good. Tiny minor comments :-)

sda/cmd/api/api.md Outdated Show resolved Hide resolved
sda/cmd/api/api.go Outdated Show resolved Hide resolved
sda/cmd/api/api.go Outdated Show resolved Hide resolved
@MalinAhlberg MalinAhlberg dismissed stale reviews from aaperis and pahatz via 0f445c8 December 2, 2024 13:57
@MalinAhlberg MalinAhlberg force-pushed the feature/api-delete-file branch from 8a745c4 to 0f445c8 Compare December 2, 2024 13:57
Copy link
Collaborator

@jbygdell jbygdell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More specific comments are coming

@MalinAhlberg MalinAhlberg force-pushed the feature/api-delete-file branch 2 times, most recently from 109e7e2 to d690e54 Compare December 3, 2024 07:43
Copy link
Contributor

@aaperis aaperis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@MalinAhlberg MalinAhlberg added this pull request to the merge queue Dec 10, 2024
Merged via the queue into main with commit f092c42 Dec 10, 2024
29 checks passed
@MalinAhlberg MalinAhlberg deleted the feature/api-delete-file branch December 10, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[api] delete files from inbox
7 participants